
import requests
import xlrd
import pymysql


def geocode(adrs):
    req = requests.get(f'https://restapi.amap.com/v3/geocode/geo?address={adrs}&output=JSON&key'
                       '=6487568d7a414da8b2dd04105d09748b')

    request_json = req.json()
    longitude_and_latitude = request_json['geocodes'][0]['location'].split(',')
    print(longitude_and_latitude)


if __name__ == '__main__':
    geocode('西安市碑林区西安交通大学兴庆校区')